<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>开机</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.5,maximum-scale=1.0,
    minimum-scale=1.0,user-scalable=no">
    <!-- <link rel="stylesheet" href="mui-master/dist/css/mui.css"> -->

    <link href="https://cdnjs.cloudflare.com/ajax/libs/roundSlider/1.3.2/roundslider.min.css" rel="stylesheet" />

</head>
<style>
    * {
        padding: 0px;
        margin: 0px;
        box-sizing: border-box;
    }


    @font-face {
        font-family: 'CentraleSansCnd-Medium';
        src: url('font/CentraleSansCnd-Medium.otf');
    }

    @font-face {
        font-family: 'CentraleSansCnd-Light';
        src: url('font/CentraleSansCnd-Light.otf');
    }

    html,
    body {
        background: url("image/primary_bg.png") no-repeat left top;
        width: 100%;
        height: 100%;
        background-size: 100% 100%;
    }

    /*测试开始*/
    .btn {
        width: 35px;
        height: 40px;
        z-index: 999;
        position: absolute;
        left: 50%;
        transform: translate(290%, 136%);
    }

    .btn img {
        width: 35px;
        height: 40px;
    }

    .tiny_low_middle_high {
        width: 69px;
        height: 66px;
        width: 279px;
        margin: 0 auto;
        display: flex;
        line-height: 44px;
        justify-content: space-between;
    }

    .tiny_low_middle_high>div {
        font-size: 14px;
        text-align: center;
        width: 25%;
        font-family: SourceHanSansCN-Regular;
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
    }

    .function {
        height: 140px;
        width: 279px;
        margin: 0 auto;
    }

    .function>div {
        float: left;
        width: 68px;
        height: 80px;
        display: flex;
        flex-direction: column;
        margin-left: 1px;
    }

    .function>div>div {
        text-align: center;
        font-size: 14px;
    }

    .function img {
        width: 22px;
        /* height: 14px; */
        margin: 0 auto;
    }

    .function text {
        font-size: 14px;
        font-family: SourceHanSansCN-Regular;
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
    }

    .function>div>div {
        margin-top: 19px;
        font-family: SourceHanSansCN-Regular;
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
    }

    .model_select_frame_big {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.2);
        display: none;
        position: absolute;
        left: 0px;
        bottom: 0px;
        z-index: 999;
    }

    .model_select_frame_top {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.2);
        display: block;
        left: 0px;
        top: 0px;
    }

    .model_select_frame {
        width: 100%;
        height: 280px;
        background: rgba(255, 255, 255, 1);
        position: absolute;
        left: 0px;
        bottom: 0px;
        z-index: 999;
        display: none;
        padding-left: 18px;
        padding-right: 18px;
    }

    .model_select_frame>div {
        width: 100%;
        height: 56px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .model_select_frame img {
        width: 24px;
        /* height: 19px; */
    }

    .model_select_frame .close,
    .model_select_frame .common,
    .model_select_frame .youth,
    .model_select_frame .child,
    .model_select_frame .old {
        height: 100%;
        display: flex;
        align-items: center;
    }

    .model_select_frame .button {
        width: 20px;
        height: 20px;
    }

    .model_select_frame .close_model,
    .model_select_frame .common_model,
    .model_select_frame .youth_model,
    .model_select_frame .child_model,
    .model_select_frame .old_model {
        font-size: 14px;
        font-family: SourceHanSansCN-Regular;
        font-weight: 400;
        color: rgba(40, 40, 40, 1);
        margin-left: 31px;
    }

    /*上下摆风弹框开始*/
    .left_right_swinging_wind_big {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.2);
        display: none;
        position: absolute;
        left: 0px;
        bottom: 0px;
        z-index: 999;
    }

    .left_right_swinging_wind_top {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.2);
        display: block;
        left: 0px;
        top: 0px;
    }

    .left_right_swinging_wind {
        /* height: 448px; */
        width: 100%;
        background: rgba(255, 255, 255, 1);
        position: absolute;
        left: 0px;
        bottom: 0px;
        z-index: 999;
        display: none;
        padding-left: 18px;
        padding-right: 18px;
    }

    .left_right_swinging_wind>div {
        width: 100%;
        height: 56px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .left_right_swinging_wind img {
        width: 24px;
        height: 19px;
    }

    .left_right_swinging_wind .sweeping_wind,
    .left_right_swinging_wind .automatic,
    .left_right_swinging_wind .wind_direction_one,
    .left_right_swinging_wind .wind_direction_two,
    .left_right_swinging_wind .wind_direction_three,
    .left_right_swinging_wind .wind_direction_four,
    .left_right_swinging_wind .wind_direction_five,
    .left_right_swinging_wind .wind_direction_six {
        height: 100%;
        display: flex;
        align-items: center;
    }

    .left_right_swinging_wind .button {
        width: 20px;
        height: 20px;
    }

    .left_right_swinging_wind .sweeping_wind_model,
    .left_right_swinging_wind .automatic_model,
    .left_right_swinging_wind .wind_direction_one_model,
    .left_right_swinging_wind .wind_direction_two_model,
    .left_right_swinging_wind .wind_direction_three_model,
    .left_right_swinging_wind .wind_direction_four_model,
    .left_right_swinging_wind .wind_direction_five_model,
    .left_right_swinging_wind .wind_direction_six_model {
        font-size: 14px;
        font-family: SourceHanSansCN-Regular;
        font-weight: 400;
        color: rgba(40, 40, 40, 1);
        margin-left: 31px;
    }

    /*上下摆风弹框结束*/
    /*睡眠设置弹框开始*/
    .sleep_settings_big {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.2);
        display: none;
        position: fixed;
        left: 0px;
        bottom: 0px;
        z-index: 999;
    }

    .sleep_settings_top {
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.2);
        display: block;
        left: 0px;
        top: 0px;
    }

    .sleep_settings {
        width: 100%;
        background: rgba(255, 255, 255, 1);
        position: fixed;
        left: 0px;
        bottom: 0;
        z-index: 999;
        display: none;
        padding-left: 18px;
        padding-right: 18px;
    }

    .sleep_settings>div {
        width: 100%;
        height: 56px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .sleep_settings img {
        width: 24px;
        /* height: 19px; */
    }

    .sleep_settings .automatism,
    .sleep_settings .refrigeration,
    .sleep_settings .heating,
    .sleep_settings .dehumidification,
    .sleep_settings .air_supply {
        height: 100%;
        display: flex;
        align-items: center;
    }

    .sleep_settings .automatism .sweeping_wind_model,
    .sleep_settings .refrigeration .sweeping_wind_model,
    .sleep_settings .heating .sweeping_wind_model,
    .sleep_settings .dehumidification .sweeping_wind_model,
    .sleep_settings .air_supply .sweeping_wind_model {
        margin-left: 31px;
    }

    /*睡眠设置弹框结束*/
    .circular {
        width: 16px;
        height: 16px;
        background-color: #FFFFFF;
        border-radius: 16px;
        margin-left: 35px;
        margin-top: -5px;
    }

    /*滑块测试开始*/
    .lineDiv {
        position: relative;
        width: 279px;
        background: rgba(30, 157, 138, 1);
        height: 4px;
        border-radius: 4px;
        margin: 0 auto;
        margin-top: 130px;
    }

    .lineDiv .minDiv {
        position: absolute;
        top: -10px;
        left: 0;
        width: 20px;
        height: 20px;
        background-color: #FFFFFF;
        cursor: pointer;
        border-radius: 50%;
    }

    .lineDiv .minDiv .vals {
        position: absolute;
        font-size: 20px;
        top: -45px;
        left: -10px;
        width: 35px;
        height: 35px;
        line-height: 35px;
        text-align: center;
        background: blue;
    }

    .lineDiv .minDiv .vals:after {
        content: "";
        width: 0px;
        height: 0px;
        border-top: 6px solid blue;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-bottom: 6px solid transparent;
        display: block;
        margin-left: 11px;
    }

    .left_line {
        width: 1px;
        height: 5px;
        background-color: #ADD9DB;
        position: absolute;
        left: 25%;
        top: 0px;
    }

    .middle_line {
        width: 1px;
        height: 5px;
        background-color: #ADD9DB;
        position: absolute;
        left: 50%;
        top: 0px;
    }

    .right_line {
        width: 1px;
        height: 5px;
        background-color: #ADD9DB;
        position: absolute;
        left: 75%;
        top: 0px;
    }

    /*滑块测试结束*/
    /*圆框的开始*/
    .rs-bg-color {
        background-color: #5CBCB8;
        z-index: 999;
        opacity: 0;
    }

    /*.rs-path-color 这个类控制的是圆环的颜色*/
    .rs-path-color {
        background-color: pink;
        opacity: 0;
    }

    /*.rs-border 这个类控制的是两个圆的内外边框*/
    .rs-border {
        border: 0 none;
    }

    .full .rs-tooltip {
        top: 50%;
        left: 50%;
        z-index: 999;
        font-size: 56px;
        font-family: CentraleSansCnd-Medium;
        font-weight: 500;
        color: rgba(255, 255, 255, 1);
    }

    .rs-handle {
        background-color: #FFFFFF;
    }

    .bg_cycle {
        width: 200px;
        height: 176px;
        margin: 0 auto;
        z-index: 999;
    }

    .bg_cycle img {
        width: 200px;
        height: 176px;
    }

    .slider_bg_cycle {
        position: relative;
        width: 100%;
        height: 181px;
        padding-top: 52px;
    }

    #slider {
        margin-top: 0px;
        position: absolute;
        /*让定位的元素垂直水平居中*/
        left: 50%;
        margin-left: -100px;
    }

    /*控制里面的数字的大小和位置*/
    .rs-container .rs-tooltip.rs-tooltip-text.edit {
        font-size: 56px;
        font-family: CentraleSansCnd-Medium;
        font-weight: 500;
        color: rgba(255, 255, 255, 1);
        margin-top: 36px;
    }

    .centigrade {
        position: absolute;
        z-index: 999;
        color: #FFFFFF;
        font-size: 18px;
        left: 50%;
        transform: translate(180%, -500%);
    }

    .Current_room_temperature {
        position: absolute;
        left: 50%;
        transform: translate(-50%, -250%);
        z-index: 999;
        color: #FFFFFF;
        font-size: 12px;
        font-family: SourceHanSansCN-Regular;
        font-weight: 400;
        color: rgba(254, 254, 254, 1);
    }

    /*雪花图标*/
    .snowflake {
        width: 22px;
        height: 20px;
        position: absolute;
        left: 50%;
        transform: translate(-50%, -90%);
        z-index: 999;
    }

    .snowflake img {
        width: 22px;
        height: 20px;
    }

    .rs-handle {
        height: 20px !important;
        width: 20px !important;
        margin: -10px 0px 0px !important;
    }
</style>

<body>

    <div class="slider_bg_cycle">
        <div id="slider"></div>
        <div class="bg_cycle">
            <img src="image/round_frame3.png" alt="">
        </div>
        <div class="centigrade">℃</div>
        <div class="Current_room_temperature">当前室温20℃</div>
        <div class="snowflake">
            <img src="image/snowflake@3x.png" alt="">
        </div>
    </div>
    <div class="btn">
        <img class="close1" src="image/PowerSwitch_1@3x.png" alt="">
        <img style="display: none" class="close2" src="image/PowerSwitch_0.png" alt="">
    </div>
    <!--滑块开始-->
    <center>
        <h3 style="display: none">用鼠标拖动小方块<span id="msg">0</span>%</h3>
    </center>
    <div id="lineDiv" class="lineDiv">
        <div class="left_line"></div>
        <div class="middle_line"></div>
        <div class="right_line"></div>
        <div class="minDivBox">
            <div id="minDiv" class="minDiv">
                <div id="vals" class="vals" style="display:none">0</div>
            </div>
        </div>
    </div>
    <!--滑块结束-->
    <div class="tiny_low_middle_high">
        <div>微</div>
        <div>低</div>
        <div>中</div>
        <div>高</div>
    </div>
    <div class="function">
        <!--上下摆风开启状态-->
        <div style="display: none" class="up_down_wind up_down_wind_open">
            <img src="image/VerticalSwitch_open@3x.png" alt="">
            <div style="color: #167668">上下摆风</div>
        </div>
        <!--上下摆风关闭状态-->
        <div class="up_down_wind up_down_wind_close">
            <img src="image/VerticalSwitch_close@3x.png" alt="">
            <div>上下摆风</div>
        </div>
        <!--左右摆风开启状态-->
        <div style="display: none" class="left_right_swaying_wind_switch left_right_swaying_wind_switch_open">
            <img src="image/HorizontalSwitch_open@3x.png" alt="">
            <div style="color: #167668">左右摆风</div>
        </div>
        <!--左右摆风关闭状态-->
        <div class="left_right_swaying_wind_switch left_right_swaying_wind_switch_close">
            <img src="image/HorizontalSwitch_close@3x.png" alt="">
            <div>左右摆风</div>
        </div>
        <!--睡眠开启状态-->
        <div style="display: none" class="pattern open_state pattern_open">
            <img src="image/sleep_yes@3x.png" alt="">
            <div style="color: #167668">睡眠</div>
        </div>
        <!--睡眠关闭状态-->
        <div class="pattern pattern_close">
            <img src="image/sleep_no@3x.png" alt="">
            <div>睡眠</div>
        </div>
        <!--强力开启状态-->
        <div style="display: none" class="strong_switch strong_switch_open">
            <img src="image/Turbo_1@3x.png" alt="">
            <div style="color: #167668">强力</div>
        </div>
        <!--强力关闭状态-->
        <div class="strong_switch close_state strong_switch_close">
            <img src="image/Turbo_0@3x.png" alt="">
            <div>强力</div>
        </div>
        <!--亮度开启状态-->
        <div style="display: none" class="brightness_switch brightness_switch_open">
            <img src="image/Screen_1@3x.png" alt="">
            <div style="color: #167668">亮度</div>
        </div>
        <!--亮度关闭状态-->
        <div class="brightness_switch brightness_switch_close">
            <img src="image/Screen_0@3x.png" alt="">
            <div>亮度</div>
        </div>
        <!--定时开启状态-->
        <div style="display: none" class="timing_switch timing_switch_open">
            <img src="image/timing-1@3x.png" alt="">
            <div style="color: #167668">定时</div>
        </div>
        <!--定时关闭状态-->
        <div class="timing_switch timing_switch_close">
            <img src="image/timing-2@3x.png" alt="">
            <div>定时</div>
        </div>
        <!--模式开启状态-->
        <div style="display: none" class="sleep sleep_open">
            <img src="image/WorkMode_yes@3x.png" alt="">
            <div style="color: #167668">模式</div>
        </div>
        <!--模式关闭状态-->
        <div class="sleep sleep_close">
            <img src="image/WorkMode_no.png" alt="">
            <div>模式</div>
        </div>
        <!--电辅热开启状态-->
        <div style="display: none" class="electric_heat_switch electric_heat_switch_open">
            <img src="image/PTC_1@3x.png" alt="">
            <div style="color: #167668">电辅热</div>
        </div>
        <!--电辅热关闭状态-->
        <div class="electric_heat_switch electric_heat_switch_close">
            <img src="image/PTC_0@3x.png" alt="">
            <div>电辅热</div>
        </div>
    </div>
    <!--模式选择的弹框-->
    <div class="model_select_frame_big">
        <div class="model_select_frame_top"></div>
        <div class="model_select_frame">
            <div class="first_btn">
                <div class="close">
                    <img src="image/sleep_0@3x.png" alt="">
                    <div class="close_model">关闭</div>
                </div>
                <div>
                    <img class="button close_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button close_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="common">
                    <img src="image/sleep_1@3x.png" alt="">
                    <div class="common_model">普通模式</div>
                </div>
                <div>
                    <img style="display: none" class="button common_btn1" src="image/btn_close@3x.png" alt="">
                    <img class="button common_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="youth">
                    <img src="image/sleep_2@3x.png" alt="">
                    <div class="youth_model">青年模式</div>
                </div>
                <div>
                    <img class="button youth_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button youth_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="child">
                    <img src="image/sleep_3@3x.png" alt="">
                    <div class="child_model">儿童模式</div>
                </div>
                <div>
                    <img class="button child_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button child_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="old">
                    <img src="image/sleep_4@3x.png" alt="">
                    <div class="old_model">老人模式</div>
                </div>
                <div>
                    <img class="button old_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button old_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
        </div>
    </div>
    <!--上下摆风的弹框-->
    <div class="left_right_swinging_wind_big">
        <div class="left_right_swinging_wind_top"></div>
        <div class="left_right_swinging_wind">
            <div>
                <div class="sweeping_wind">
                    <img src="image/VerticalSwitch_0@3x.png" alt="">
                    <div class="sweeping_wind_model">扫风</div>
                </div>
                <div>
                    <img class="button sweeping_wind_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button sweeping_wind_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="automatic">
                    <img src="image/VerticalSwitch_1@3x.png" alt="">
                    <div class="automatic_model">自动</div>
                </div>
                <div>
                    <img class="button automatic_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button automatic_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="wind_direction_one">
                    <img src="image/VerticalSwitch_2.png" alt="">
                    <div class="wind_direction_one_model">风向1</div>
                </div>
                <div>
                    <img class="button wind_direction_one_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button wind_direction_one_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="wind_direction_two">
                    <img src="image/VerticalSwitch_3@3x.png" alt="">
                    <div class="wind_direction_two_model">风向2</div>
                </div>
                <div>
                    <img class="button wind_direction_two_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button wind_direction_two_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="wind_direction_three">
                    <img src="image/VerticalSwitch_4@3x.png" alt="">
                    <div class="wind_direction_three_model">风向3</div>
                </div>
                <div>
                    <img class="button wind_direction_three_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button wind_direction_three_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="wind_direction_four">
                    <img src="image/VerticalSwitch_5@3x.png" alt="">
                    <div class="wind_direction_four_model">风向4</div>
                </div>
                <div>
                    <img class="button wind_direction_four_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button wind_direction_four_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="wind_direction_five">
                    <img src="image/VerticalSwitch_6@3x.png" alt="">
                    <div class="wind_direction_five_model">风向5</div>
                </div>
                <div>
                    <img style="display: none" class="button wind_direction_five_btn1" src="image/btn_close@3x.png" alt="">
                    <img class="button wind_direction_five_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="wind_direction_six">
                    <img src="image/VerticalSwitch_7@3x.png" alt="">
                    <div class="wind_direction_six_model">风向6</div>
                </div>
                <div>
                    <img class="button wind_direction_six_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button wind_direction_six_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
        </div>
    </div>
    <!--睡眠设置的弹框-->
    <div class="sleep_settings_big">
        <div class="sleep_settings_top"></div>
        <div class="sleep_settings">
            <div>
                <div class="automatism">
                    <img src="image/WorkMode_0.png" alt="">
                    <div class="sweeping_wind_model">自动</div>
                </div>
                <div>
                    <img class="button automatism_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button automatism_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="refrigeration">
                    <img src="image/WorkMode_1@3x.png" alt="">
                    <div class="sweeping_wind_model">制冷</div>
                </div>
                <div>
                    <img style="display: none" class="button refrigeration_btn1" src="image/btn_close@3x.png" alt="">
                    <img class="button refrigeration_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="heating">
                    <img src="image/WorkMode_2@3x.png" alt="">
                    <div class="sweeping_wind_model">制热</div>
                </div>
                <div>
                    <img class="button heating_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button heating_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="dehumidification">
                    <img src="image/WorkMode_4@3x.png" alt="">
                    <div class="sweeping_wind_model">除湿</div>
                </div>
                <div>
                    <img class="button dehumidification_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button dehumidification_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
            <div>
                <div class="air_supply">
                    <img src="image/WorkMode_3@3x.png" alt="">
                    <div class="sweeping_wind_model">送风</div>
                </div>
                <div>
                    <img class="button air_supply_btn1" src="image/btn_close@3x.png" alt="">
                    <img style="display: none" class="button air_supply_btn2" src="image/btn_open@3x.png" alt="">
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.bootcss.com/zepto/1.0rc1/zepto.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/roundSlider/1.3.2/roundslider.min.js"></script>
    <script src="js/index.js"></script>

    <!-- <script src="mui-master/dist/js/mui.js"></script> -->
    <script>


        var minDiv = document.getElementById('minDiv'); //小方块
        var lineDiv = document.getElementById('lineDiv'); //长线条
        var msg = document.getElementById("msg");
        var vals = document.getElementById("vals");
        var ifBool = false; //判断鼠标是否按下
        var lineDiv_left = "";
        var minDiv_left = "";
        var roundSlider = "";
        var distanceX = "";


        // 调用客户端定时
        function timing(iotId) {
            if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {  //判断iPhone|iPad|iPod|iOS 
                window.webkit.messageHandlers.setTiming.postMessage(iotId);
            } else if (/(Android)/i.test(navigator.userAgent)) {   //判断Android//alert(navigator.userAgent);
                window.android.setTiming();
            }
        }

        //获取客户端的返回码(客户端调用)   的函数的封装
        function controlState(newName) {
            // 电源开关
            if (newName.items.PowerSwitch == 1) {
                openSwitch();
            } else if (newName.items.PowerSwitch == 0) {
                closeSwitch();
            }
            // 风速
            // alert(newName.windSpeedNum);
            if (newName.windSpeedNum) {
                // minDiv.style.left = newName.windSpeedNum + "px";
            }
            // 目标温度
            if (newName.items.CurrentTemperature) {
                // alert(newName.items.CurrentTemperature);
                // roundSlider.setValue(newName.items.CurrentTemperature)
                // $("#slider").roundSlider("option", "value", newName.items.CurrentTemperature);
                // $("#slider").roundSlider();
            }

            // 水平摆风开关
            if (newName.items.HorizontalSwitch == 0) {
                HorizontalSwitchClose();
            } else if (newName.items.HorizontalSwitch == 1) {
                HorizontalSwitchOpen();
            }

            // 强力
            if (newName.items.Turbo == 1) {
                turboOpen()
            } else if (newName.items.Turbo == 0) {
                turboClose();
            }
            // 电辅_辅热
            if (newName.items.PTC == 0) {
                PTCClose()
            } else if (newName.items.PTC == 1) {
                PTCOpen()
            }

            // 背景灯_屏显
            if (newName.items.Screen == 0) {
                screenClose()
            } else if (newName.items.Screen == 1) {
                screenOpen()
            }

            //工作模式
            if (newName.items.WorkMode == 0) {
                WorkModeSelfMotion()
            } else if (newName.items.WorkMode == 1) {
                WorkModeRefrigeration()
            } else if (newName.items.WorkMode == 2) {
                WorkModeHeating()
            } else if (newName.items.WorkMode == 3) {
                WorkModeVentilate()
            } else if (newName.items.WorkMode == 4) {
                WorkModeXeransis()
            }

            //上下风门
            if (newName.items.VerticalSwitch == 0) {
                VerticalSwitchWindsweeper();
            } else if (newName.items.VerticalSwitch == 1) {
                VerticalSwitchSelfMotion()
            } else if (newName.items.VerticalSwitch == 2) {
                VerticalSwitchDirection1()
            } else if (newName.items.VerticalSwitch == 3) {
                VerticalSwitchDirection2()
            } else if (newName.items.VerticalSwitch == 4) {
                VerticalSwitchDirection3()
            } else if (newName.items.VerticalSwitch == 5) {
                VerticalSwitchDirection4()
            } else if (newName.items.VerticalSwitch == 6) {
                VerticalSwitchDirection5()
            } else if (newName.items.VerticalSwitch == 7) {
                VerticalSwitchDirection6()
            }

            //睡眠
            if (newName.items.sleep == 0) {
                sleepClose()
            } else if (newName.items.sleep == 1) {
                sleepCommon()
            } else if (newName.items.sleep == 2) {
                sleepYouth()
            } else if (newName.items.sleep == 3) {
                sleepChild()
            } else if (newName.items.sleep == 4) {
                sleepAgedness()
            }
        }
        function setInfo(element) {
            console.log(element);
            if (element.attribute == "CurrentTemperature") {
                // 调用温度
                CurrentTemperatureChange(element.value, iotId);
            }

            //水平摆风
            if (element.attribute == "HorizontalSwitch") {
                if (element.value == 0) {
                    HorizontalSwitchClose();
                } else if (element.value == 1) {
                    HorizontalSwitchOpen();
                }
            }
            //电辅_辅热 
            if (element.attribute == "PTC") {
                if (element.value == 0) {
                    PTCClose()
                } else if (element.value == 1) {
                    PTCOpen()
                }
            }
            //电源开关
            if (element.attribute == "PowerSwitch") {
                if (element.value == 1) {
                    openSwitch();
                    up_down_wind_open();
                } else if (element.value == 0) {
                    closeSwitch();
                }
            }
            //背景灯_屏显
            if (element.attribute == "Screen") {
                if (element.value == 0) {
                    screenClose();
                } else if (element.value == 1) {
                    screenOpen();
                }
            }
            //目标温度
            if (element.attribute == "TargetTemperature") {
                var TargetTemperatureValue = "当前室温" + element.value + "℃";
                $(".Current_room_temperature").text(TargetTemperatureValue);
            }
            //强力
            if (element.attribute == "Turbo") {
                if (element.value == 1) {
                    turboOpen()
                } else if (element.value == 0) {
                    turboClose();
                }
            }
            //上下风门
            if (element.attribute == "VerticalSwitch") {
                if (element.value == 0) {
                    VerticalSwitchWindsweeper();
                } else if (element.value == 1) {
                    VerticalSwitchSelfMotion()
                } else if (element.value == 2) {
                    VerticalSwitchDirection1()
                } else if (element.value == 3) {
                    VerticalSwitchDirection2()
                } else if (element.value == 4) {
                    VerticalSwitchDirection3()
                } else if (element.value == 5) {
                    VerticalSwitchDirection4()
                } else if (element.value == 6) {
                    VerticalSwitchDirection5()
                } else if (element.value == 7) {
                    VerticalSwitchDirection6()
                }
            }
            //风速
            if (element.attribute == "WindSpeed") {
                let minDivLeft;
                if (element.value == 1) {
                    minDivLeft = parseInt(12.5/100*(lineDiv.offsetWidth-10));
                } else if (element.value == 2) {
                    minDivLeft = parseInt(37.5/100*(lineDiv.offsetWidth-10));
                } else if (element.value == 3) {
                    minDivLeft = parseInt(62.5/100*(lineDiv.offsetWidth-10));
                } else if (element.value == 4) {
                    minDivLeft = parseInt(87.5/100*(lineDiv.offsetWidth-10));
                }
                minDiv.style.left = minDivLeft + "px";
            }
            //工作模式
            if (element.attribute == "WorkMode") {
                if (element.value == 0) {
                    WorkModeSelfMotion();
                } else if (element.value == 1) {
                    WorkModeRefrigeration()
                } else if (element.value == 2) {
                    WorkModeHeating()
                } else if (element.value == 3) {
                    WorkModeVentilate()
                } else if (element.value == 4) {
                    WorkModeXeransis()
                }
            }
            //睡眠
            if (element.attribute == "sleep") {
                if (element.value == 0) {
                    sleepClose()
                } else if (element.value == 1) {
                    sleepCommon()
                } else if (element.value == 2) {
                    sleepYouth()
                } else if (element.value == 3) {
                    sleepChild()
                } else if (element.value == 4) {
                    sleepAgedness()
                }
            }
        }

        function getResultCode(name) {
            if (name != '') {
                controlState(name)
            }
        }

        function getResultCodeIOS(name) {
            //判断状态码   200为成功 刷新ui,刷新ui就是切换图片
            // alert(name);
            if (name != '') {
                let newName = JSON.parse(name)
                controlState(newName)
            }
        }

        $(function () {
            let iotId = getIotId();

            var clientWidth = document.documentElement.clientWidth;
            var clientHeight = document.documentElement.clientHeight;

            let newData = {
                iotId: "bCp9yYKGJMfs1fB4GvqI0010fb8200"
            }
            $.ajax({
                type: "Post",
                url: "http://47.93.186.16:80/iot/getThingProperties",
                data: newData,
                dataType: "json",
                success: function (response) {
                    // console.log(response.data)
                    $(response.data).each(function (index, element) {
                        //当前温度
                        setInfo(element);
                    });
                }
            });


            $(".rs-overlay").remove()

            //控制模式的弹框的显示
            $(".pattern").on("click", function () {
                $(".model_select_frame_big").show();
                $(".model_select_frame").show();
            })

            //模式选择关闭按钮
            $(".first_btn").on("click", function () {
                $(".model_select_frame_big").show();
            })

            //控制模式的弹框的隐藏
            $(".model_select_frame_top").on("click", function () {
                $(".model_select_frame_big").hide();
            })

            //控制上下摆风的弹框的显示
            $(".up_down_wind").on("click", function () {
                $(".left_right_swinging_wind").show();
                $(".left_right_swinging_wind_big").show();
            })

            //控制上下摆风的弹框的隐藏
            $(".left_right_swinging_wind_top").on("click", function () {
                $(".left_right_swinging_wind_big").hide();
            })

            //控制睡眠设置的弹框显示
            $(".sleep").on("click", function () {
                $(".sleep_settings").show();
                $(".sleep_settings_big").show();
            })

            //控制睡眠设置的弹框隐藏
            $(".sleep_settings_top").on("click", function () {
                $(".sleep_settings").hide();
                $(".sleep_settings_big").hide();
            })

            //控制开关按钮
            $(".close1").on("click", function (e) {
                e.preventDefault();
                let data = {
                    iotId: iotId,
                    items: {
                        PowerSwitch: 0
                    }
                }
                data = JSON.stringify(data);
                biography(data)
            })
            $(".close2").on("click", function (e) {
                e.preventDefault();
                let data = {
                    iotId: iotId,
                    items: {
                        PowerSwitch: 1
                    }
                }
                data = JSON.stringify(data);
                biography(data);

            })
            //  模式选择的弹框的图片切换

            //1.关闭按钮
            $(".close_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        sleep: 0
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".close_btn2").click(function () {
            //     $(".close_btn2").hide();
            //     $(".close_btn1").show();
            // })

            //2.普通模式
            $(".common_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        sleep: 1
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".common_btn2").click(function () {
            //     $(".common_btn2").hide();
            //     $(".common_btn1").show();
            // })

            //青年模式
            $(".youth_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        sleep: 2
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".youth_btn2").click(function () {
            //     $(".youth_btn2").hide();
            //     $(".youth_btn1").show();
            // })

            //儿童模式
            $(".child_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        sleep: 3
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".child_btn2").click(function () {
            //     $(".child_btn2").hide();
            //     $(".child_btn1").show();
            // })

            //老人模式
            $(".old_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        sleep: 4
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".old_btn2").click(function () {
            //     $(".old_btn2").hide();
            //     $(".old_btn1").show();
            // })
            //    睡眠的弹框的图片切换

            //1.自动
            $(".automatism_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        WorkMode: 0
                    },
                }
                data = JSON.stringify(data);
                biography(data)
                //结束
            })
            // $(".automatism_btn2").click(function () {
            //     $(".automatism_btn2").hide();
            //     $(".automatism_btn1").show();
            // })

            //2.制冷
            $(".refrigeration_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        WorkMode: 1
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".refrigeration_btn2").click(function () {
            //     $(".refrigeration_btn2").hide();
            //     $(".refrigeration_btn1").show();
            // })

            //3.制热
            $(".heating_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        WorkMode: 2
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".heating_btn2").click(function () {
            //     $(".heating_btn2").hide();
            //     $(".heating_btn1").show();
            // })

            //4.除湿
            $(".dehumidification_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        WorkMode: 4
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".dehumidification_btn2").click(function () {
            //     $(".dehumidification_btn2").hide();
            //     $(".dehumidification_btn1").show();
            // })

            //5.送风
            $(".air_supply_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        WorkMode: 3
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".air_supply_btn2").click(function () {
            //     $(".air_supply_btn2").hide();
            //     $(".air_supply_btn1").show();
            // })
            //    上下摆风的弹框的图片切换

            //1.扫风
            $(".sweeping_wind_btn1").click(function () {
                // VerticalSwitchWindsweeper()
                let data = {
                    iotId: iotId,
                    items: {
                        VerticalSwitch: 0
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".sweeping_wind_btn2").click(function () {
            //     $(".sweeping_wind_btn2").hide();
            //     $(".sweeping_wind_btn1").show();
            // })
            // 自动
            $(".automatic_btn1").click(function () {
                // VerticalSwitchSelfMotion()
                let data = {
                    iotId: iotId,
                    items: {
                        VerticalSwitch: 1
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".automatic_btn2").click(function () {
            //     $(".automatic_btn2").hide();
            //     $(".automatic_btn1").show();
            // })
            // 风向1
            $(".wind_direction_one_btn1").click(function () {
                // VerticalSwitchDirection1()
                let data = {
                    iotId: iotId,
                    items: {
                        VerticalSwitch: 2
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".wind_direction_one_btn2").click(function () {
            //     $(".wind_direction_one_btn2").hide();
            //     $(".wind_direction_one_btn1").show();
            // })
            // 方向2
            $(".wind_direction_two_btn1").click(function () {
                // VerticalSwitchDirection2()
                let data = {
                    iotId: iotId,
                    items: {
                        VerticalSwitch: 3
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".wind_direction_two_btn2").click(function () {
            //     $(".wind_direction_two_btn2").hide();
            //     $(".wind_direction_two_btn1").show();
            // })
            //5.风向3
            $(".wind_direction_three_btn1").click(function () {
                // VerticalSwitchDirection3()
                let data = {
                    iotId: iotId,
                    items: {
                        VerticalSwitch: 4
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".wind_direction_three_btn2").click(function () {
            //     $(".wind_direction_three_btn2").hide();
            //     $(".wind_direction_three_btn1").show();
            // })
            //6.风向4
            $(".wind_direction_four_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        VerticalSwitch: 5
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".wind_direction_four_btn2").click(function () {
            //     $(".wind_direction_four_btn2").hide();
            //     $(".wind_direction_four_btn1").show();
            // })
            //7.风向5
            $(".wind_direction_five_btn1").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        VerticalSwitch: 6
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".wind_direction_five_btn2").click(function () {
            //     $(".wind_direction_five_btn2").hide();
            //     $(".wind_direction_five_btn1").show();
            // })
            //8.风向6
            $(".wind_direction_six_btn1").click(function () {
                // VerticalSwitchDirection6()
                let data = {
                    iotId: iotId,
                    items: {
                        VerticalSwitch: 7
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // $(".wind_direction_six_btn2").click(function () {
            //     $(".wind_direction_six_btn2").hide();
            //     $(".wind_direction_six_btn1").show();
            // })
            //   功能开关进行开启和关闭的切换

            // 1.上下摆风
            // $(".up_down_wind_close").click(function () {
            //     up_down_wind_close();
            // })
            // $(".up_down_wind_open").click(function () {
            //     up_down_wind_open();
            // })
            // 2.左右摆风
            $(".left_right_swaying_wind_switch_open").click(function () {
                console.log("左右摆风")
                let data = {
                    iotId: iotId,
                    items: {
                        HorizontalSwitch: 0
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            $(".left_right_swaying_wind_switch_close").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        HorizontalSwitch: 1
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            // 3. 睡眠
            $(".pattern_open").click(function () {
                $(".pattern_close").show();
                $(".pattern_open").hide();
            })
            $(".pattern_close").click(function () {
                $(".pattern_close").hide();
                $(".pattern_open").show();
            })
            // 4.强力
            $(".strong_switch_open").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        Turbo: 0
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            $(".strong_switch_close").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        Turbo: 1
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })

            // 5.亮度
            $(".brightness_switch_open").click(function () {
                // console.log("睡眠")
                let data = {
                    iotId: iotId,
                    items: {
                        Screen: 0
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            $(".brightness_switch_close").click(function () {
                console.log("睡眠")
                let data = {
                    iotId: iotId,
                    items: {
                        Screen: 1
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })

            // 6.定时
            $(".timing_switch_open").click(function () {
                timing(iotId);
                $(".timing_switch_close").show();
                $(".timing_switch_open").hide();
            })
            $(".timing_switch_close").click(function () {
                timing(iotId)
                $(".timing_switch_close").hide();
                $(".timing_switch_open").show();
            })

            // 7.模式
            $(".sleep_open").click(function () {
                console.log("睡眠")
                $(".sleep_close").show();
                $(".sleep_open").hide();
            })
            $(".sleep_close").click(function () {
                console.log("睡眠")
                $(".sleep_close").hide();
                $(".sleep_open").show();
            })

            // 8.电辅热
            $(".electric_heat_switch_open").click(function () {

                let data = {
                    iotId: iotId,
                    items: {
                        PTC: 0
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })
            $(".electric_heat_switch_close").click(function () {
                let data = {
                    iotId: iotId,
                    items: {
                        PTC: 1
                    },
                }
                data = JSON.stringify(data);
                biography(data)
            })

            // 手指点下的时候(风速)
            var startX;
            $('#minDiv').bind('touchstart', function (e) {
                e.preventDefault();
                // debugger
                startX = e.originalEvent.targetTouches[0].pageX
                console.log(startX)
            });
            // 滑动事件(风速)
            $('#minDiv').bind('touchmove', function (e) {
                e.preventDefault();
                var newStartX = startX;
                //获取滑动屏幕时的X,Y
                endX = e.originalEvent.targetTouches[0].pageX;

                lineDiv_left = getPosition(lineDiv).left; //长线条的横坐标

                minDiv_left = endX - lineDiv_left; //小方块相对于父元素（长线条）的left值
                //获取滑动距离

                // alert("滑动事件改变")
                console.log("lineDiv.offsetWidth:" + lineDiv.offsetWidth)


                if (minDiv_left >= lineDiv.offsetWidth) {
                    minDiv_left = lineDiv.offsetWidth - 10;
                }
                if (minDiv_left < 0) {
                    minDiv_left = 0;
                }
                // console.log("3:" + minDiv_left);
                distanceX = parseInt((minDiv_left / (lineDiv.offsetWidth - 10)) * 100)


                msg.innerText = minDiv_left;
                vals.innerText = minDiv_left;

                minDiv.style.left = minDiv_left + "px";

            });
            // 手指离开屏幕方法(风速)
            $("#minDiv").on("touchend", function () {
                //判断滑动方向
                WindSpeedChange(distanceX, minDiv_left);
            })
        })
    </script>
</body>

</html>